package com.sg.controller.bff;

import com.sg.common.ro.OkrResult;
import com.sg.dto.biz.bff.req.BffImplementThirdPartyLoginOutReqDto;
import com.sg.service.biz.bff.UserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@Api(value = "logOut", tags = {"logOut"})
@RestController
public class LogoutController {

    @Autowired
    UserService userService;

    @PostMapping("/login")
    public OkrResult<String> handleLogout(@RequestParam("logoutSessionKey") String logoutSessionKey) {
        RestTemplate restTemplate = new RestTemplate();
        BffImplementThirdPartyLoginOutReqDto reqData = new BffImplementThirdPartyLoginOutReqDto();
        reqData.setAuthTicket(logoutSessionKey);
        System.out.println("handleLogout-" + logoutSessionKey);
        userService.implementThirdPartyLoginOut(reqData);


        return OkrResult.success("");
    }
}
